

using System;
using System.Collections.Generic;
using System.Text;
using EntityLayer;
using System.Data;
using DataAccessLayer;

namespace DataLayer
{
	public class datErrorMessages
	{
		public datErrorMessages()
		{
		}
		
		#region  Code Factory Generated Methods
        public void DeleteErrorMessagesByErrorMessageId(entErrorMessages parEntErrorMessages, DbConnector parDbConnector)
        {
            DbParamCollection insDbParamCollection = new DbParamCollection();
            insDbParamCollection.Add("@pErrorMessageId", parEntErrorMessages.ErrorMessageId);
            parDbConnector.ExecuteNonQuery("DeleteErrorMessagesByErrorMessageId", insDbParamCollection);
        }
        public void InsertErrorMessages(entErrorMessages parEntErrorMessages, DbConnector parDbConnector)
        {
            DbParamCollection insDbParamCollection = new DbParamCollection();
            insDbParamCollection.Add("@pErrorMessageName", parEntErrorMessages.ErrorMessageName);
            insDbParamCollection.AddOutput("@pErrorMessageId", DbType.Int32);
            parDbConnector.ExecuteNonQuery("InsertErrorMessages", insDbParamCollection);
            parEntErrorMessages.ErrorMessageId = Convert.ToInt32(insDbParamCollection.GetOutPutParameter().Value);
        }
        public void UpdateErrorMessagesByErrorMessageId(entErrorMessages parEntErrorMessages, DbConnector parDbConnector)
        {
            DbParamCollection insDbParamCollection = new DbParamCollection();
            insDbParamCollection.Add("@pErrorMessageId", parEntErrorMessages.ErrorMessageId);

            insDbParamCollection.Add("@pErrorMessageName", parEntErrorMessages.ErrorMessageName);
            parDbConnector.ExecuteNonQuery("UpdateErrorMessagesByErrorMessageId", insDbParamCollection);
        }
        public DataTable SelectErrorMessages(DbConnector parDbConnector)
        {

            return parDbConnector.ExecuteDataTable("SelectErrorMessages", null);
        }
        public void SelectErrorMessagesByErrorMessageId(entErrorMessages parEntErrorMessages, DbConnector parDbConnector)
        {
            DbParamCollection insDbParamCollection = new DbParamCollection();
            insDbParamCollection.Add("@pErrorMessageId", parEntErrorMessages.ErrorMessageId);
            DataTable insDataTable = new DataTable();
            insDataTable = parDbConnector.ExecuteDataTable("SelectErrorMessagesByErrorMessageId", insDbParamCollection);
            if (insDataTable.Rows.Count > 0)
            {
                if (insDataTable.Rows[0]["ErrorMessageId"] != DBNull.Value)
                {
                    parEntErrorMessages.ErrorMessageId = Convert.ToInt32(insDataTable.Rows[0]["ErrorMessageId"]);
                }
                if (insDataTable.Rows[0]["ErrorMessageName"] != DBNull.Value)
                {
                    parEntErrorMessages.ErrorMessageName = insDataTable.Rows[0]["ErrorMessageName"].ToString();
                }
            }
        }
		#endregion
	}
}